package mutilthread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.BlockingQueue;

/**
 * Created with IntelliJ IDEA.
 * Description: 阻塞队列的使用 BlockingQueue提供了另外两个专属方法（put 和 take（出））
 * User: Li_yizYa
 * Date: 2025—03—31
 * Time: 20:20
 */
public class Demo15 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(3);
        queue.put("111");
        System.out.println("put 成功");
        queue.put("111");
        System.out.println("put 成功");
//        queue.put("111");
//        System.out.println("put 成功");
//        queue.put("111");
//        System.out.println("put 成功");
        queue.take();
        System.out.println("take 成功");
        queue.take();
        System.out.println("take 成功");
        queue.take();
        System.out.println("take 成功");
    }
}
